package com.cube.truthseer.mq.bucket;

import com.cube.truthseer.common.entity.constants.MqConstants;
import com.cube.truthseer.common.entity.dto.EmailInfoDTO;
import com.cube.truthseer.entity.bucket.po.Bucket;
import com.cube.truthseer.service.IBucketService;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class BucketHandler {
    private final IBucketService bucketService;

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "bucket.capacity.queue", durable = "true"),
            exchange = @Exchange(MqConstants.Exchange.BUCKET_EXCHANGE),
            key = MqConstants.Key.BUCKET_CAPACITY
    ))
    public void calBucketCapacity(String bucketName){
        bucketService.calBucketCapacity(bucketName);
    }
}
